// 第三种方法
import React from "react"

export default class Foo extends React.Component {
    constructor() { //构造器函数
        super()
        this.state = {
            count: 0,
            msg: 'hello component'
        }
        this.handle = this.handle.bind(this)
    }
    handle(){
        this.setState({
            count:this.state.count + 5
        })
    }
    render() {
        return (
            <div>
                <h1>{this.state.count}</h1>
                <button onClick={this.handle}>+</button>
            </div>
        )
    }
}